#ifndef __H_GAME_H__
#define __H_GAME_H__

#include <deque>
#include <vector>
#include <map>
#include "ICC_Timer_Handler.h"
#include "RedisClient.h"
#include "GameBase.h"
#include "DbPart.h"
#include "CClient.h"
#include "def.h"
#include "LogicData.h"
#include "NodeDefine.h"


class CHost;
class CGameServer :public  BYTimerOject
{
public:
	CGameServer();
	virtual ~CGameServer();
public:
	// callback && interface
	virtual bool InitGame();
	virtual int OnBYTimeOut(int Timerid);
	int ProcessPacket(SocketHandler* pHandler, NETInputPacket* inputPkg);

public:
	int ProcServerRegister(NETInputPacket* inputPkg, SocketHandler* pHandler);
	int ProcQueryCacheConf(NETInputPacket* inputPkg, SocketHandler* pHandler);
	int ProcServerRegister(ServerData* pServer);
	int ProcServerClose(CClientHandler* pHandler);

public:
	bool ReadCommonConf(const char* strxml);
	int ParseConnStr(std::string& conn_str,  vector<int>& connItems);
	int NotifyNewServerConn(ServerData* pSrv);
	int PushSrvItemConnSrvType(ServerData* pSrv, int type);
	int PushSrvTypeConnSrvItem(ServerData* pSrv, int type);
	
	
	int ProcServiceManagerRegister(ServerData* pSrv, int type);
	int ProcServiceManagerClose(int type, int svid);

public:
	ConnList	 m_connList;

	CacheConfList  m_cacheList;
	DBConfList  m_DBList;

public:
	CHost* m_pHost;
};


#endif

